import { Router, Route, Switch, Redirect } from 'react-router-dom';
import Login from './pages/Login';
import NotFound from './pages/NotFound';
import GeekLayout from './pages/Layout';
import { AuthRoute } from 'components/AuthRoute';
// 导入自定义的 history 对象
import { customHistory } from 'utils';
function App() {
  return (
    <Router history={customHistory}>
      <div className="App">
        <Switch>
          <Redirect exact from="/" to="/home"></Redirect>
          {
            // 使用 AuthRoute 组件，替换 Route 组件
          }
          <AuthRoute from="/home" component={GeekLayout}></AuthRoute>
          <Route from="/login" component={Login}></Route>
          {/* 兜底：404 */}
          <Route component={NotFound} />
        </Switch>
      </div>
    </Router>
  );
}

export default App;
